package com.hx.portal.controller.hospital;


import com.alibaba.dubbo.config.annotation.Reference;
import com.hx.common.result.PageResult;
import com.hx.common.result.Result;
import com.hx.hospital.pojo.Notification;
import com.hx.hospital.service.NotificationService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/notification")
@Api(description = "通知相关接口")
public class NotificationController {

    @Reference
    private NotificationService notificationService;

    @GetMapping("/findAll")
    public List<Notification> findAll(){
        return notificationService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<Notification> findPage(int page, int size){
        return notificationService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<Notification> findList(@RequestBody Map<String,Object> searchMap){
        return notificationService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<Notification> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  notificationService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public Notification findById(Long id){
        return notificationService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody Notification notification){
        notificationService.add(notification);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody Notification notification){
        notificationService.update(notification);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(Long id){
        notificationService.delete(id);
        return new Result();
    }

}
